<?php
/**
 * 注释不留名,代码随便用
 * Date: 2019/4/22
 * Time: 19:53
 */

namespace app\common\traits;


use library\tools\Data;
use think\Db;
use think\Exception;

trait SelectN
{
    public function selectN(){
        $data = $this->request->get();
        $engine = $this->model ? :  Db::name($this->table);
        $list = $engine->where($data)->fetchCollection()->select()->toArray();
        $list = Data::arr2tree($list, 'id', 'pid', 'children');
        $this->success('列表排序成功, 正在刷新列表', $list);
    }
}